# -*- coding: utf-8 -*-
"""
@version: 0.1
@author: ljt
@license: IdooSmart
@contact: 1329331182@qq.com 
@software: PyCharm
@file: logger_config.py
@time: 2019/8/9 19:49
@descript:
"""
import datetime
import logging as logger
import os
logpath = os.path.dirname(os.path.abspath(__file__))+"/logs/"
if not os.path.exists(logpath):
    os.mkdir(logpath)
LOG_FILE = logpath + str(datetime.datetime.today().strftime('%Y-%m-%d'))+".log"
LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s"    # 日志格式化输出
DATE_FORMAT = "%m/%d/%Y %H:%M:%S %p"                        # 日期格式
fp = logger.FileHandler(LOG_FILE, encoding='utf-8')
fs = logger.StreamHandler()
logger.basicConfig(level=logger.DEBUG, format=LOG_FORMAT, datefmt=DATE_FORMAT, handlers=[fp, fs])    # 调用

# logger.debug("This is a debug log.哈哈")
# logger.info("This is a info log.")
# logger.warning("This is a warning log.")
# logger.error("This is a error log.")
# logger.critical("This is a critical log.")